package com.wex.cookbook.exception;

/**
 * ClassName: CommonErrorCode
 * description: 通用错误码
 *
 * @author wsy
 * @Date: 2022/11/20 12:13
 * @since JDK 1.8
 */
public enum CommonErrorCode {
    DB_ERROR("DB_ERROR", "数据库错误"),
    IO_ERROR("IO_ERROR", "IO异常"),
    NET_ERROR("NET_ERROR", "网络异常"),
    BUSINESS_ERROR("BUSINESS_ERROR", "业务异常"),
    TRANSACTION_ERROR("TRANSACTION_ERROR", "事务异常"),
    UNKNOWN_ERROR("UNKNOWN_ERROR", "未知异常"),
    INVALID_PARAM("INVALID_PARAM", "请求参数非法"),
    PARAM_FORMAT_ERROR("PARAM_FORMAT_ERROR", "参数格式错误"),
    REQUEST_REPEATED("REQUEST_REPEATED", "重复的请求"),
    TIMEOUT("TIMEOUT", "请求超时"),

    SERVER_ERROR("501","服务器处理异常"),
    SUCCESS("200","成功"),
    FAIL("FAIL","失败"),
    LOGIN("777","需要登录");
    ;

    private final String code;
    private final String message;

    private CommonErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public String code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }
}
